#ifndef __PARSE_URL__
#define __PARSE_URL__

#define BUFSIZE 1024
#define MAXLINE 1024

#include "tinyserver.h"

typedef struct tinybuf {
	char buf[BUFSIZE];
	char *pos;
	size_t size;
	int fd;
}TinyBuff;

typedef enum method {
	HTTP_POST,
	HTTP_GET
} Method;

typedef struct URL {
	Method method;
	char uri[MAXLINE];
	char protocol[MAXLINE];
}Url;

void tinybuf_init (TinyBuff *tb, int fd);

int read_from_fd (TinyBuff *tb);

char *read_line_from_buf (TinyBuff *tb, char *line);

int parse_url (char *line, Url *url, Setting *setting);

#endif
